package schedule.way_runnable;

/**
 * 使用线程创建定时任务Thread、Runnable、while(true)
 */
public class RunnableScheduleTask {

    public static void main(String[] args) {
        runTask();
    }

    private static int count = 0;

    private static void runTask() {

        new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    try {
                        Thread.sleep(1000);
                        System.out.println("count is:" + count++);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }

}
